package fit.conceptmap.entities;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the relationship database table.
 * 
 */
@Entity
@Table(name="relationship")
@NamedQuery(name="Relationship.findAll", query="SELECT r FROM Relationship r")
public class Relationship implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String idrelationship;

	private String name;

	//bi-directional many-to-one association to Link
	@OneToMany(mappedBy="relationship")
	private List<Link> links;

	//bi-directional many-to-one association to Concept
	@ManyToOne
	@JoinColumn(name="conceptFrom")
	private Concept conceptFrom;

	//bi-directional many-to-one association to Concept
	@ManyToOne
	@JoinColumn(name="conceptTo")
	private Concept conceptTo;

	//bi-directional many-to-one association to Conceptmap
	@ManyToOne
	@JoinColumn(name="idConceptMaps")
	private Conceptmap conceptmap;

	//bi-directional many-to-one association to MemberAssignment
	@ManyToOne
	@JoinColumn(name="idMemberAssignment")
	private MemberAssignment memberAssignment;

	public Relationship() {
	}

	public String getIdrelationship() {
		return this.idrelationship;
	}

	public void setIdrelationship(String idrelationship) {
		this.idrelationship = idrelationship;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<Link> getLinks() {
		return this.links;
	}

	public void setLinks(List<Link> links) {
		this.links = links;
	}

	public Link addLink(Link link) {
		getLinks().add(link);
		link.setRelationship(this);

		return link;
	}

	public Link removeLink(Link link) {
		getLinks().remove(link);
		link.setRelationship(null);

		return link;
	}

	public Concept getConceptFrom() {
		return this.conceptFrom;
	}

	public void setConceptFrom(Concept conceptFrom) {
		this.conceptFrom = conceptFrom;
	}

	public Concept getConceptTo() {
		return this.conceptTo;
	}

	public void setConceptTo(Concept conceptTo) {
		this.conceptTo = conceptTo;
	}

	public Conceptmap getConceptmap() {
		return this.conceptmap;
	}

	public void setConceptmap(Conceptmap conceptmap) {
		this.conceptmap = conceptmap;
	}

	public MemberAssignment getMemberAssignment() {
		return this.memberAssignment;
	}

	public void setMemberAssignment(MemberAssignment memberAssignment) {
		this.memberAssignment = memberAssignment;
	}

}